#include "HttpServer.hpp"

void login(HttpRequest&req,HttpResponse&resp)
{
    LOG(LogLevel::DEBUG)<<"进入登录功能逻辑";
    //1、解析参数格式

    //2、fangwenshujuku1

    //3、登陆成功

    // std::string body=req.GetContent("wwwroot/success.html");
    // resp.SetCode(200);
    // resp.SetHeader("Content_Length",std::to_string(body.size()));
    // resp.SetHeader("Content_Type","text/html");
    // resp.SetBody(body);

    resp.SetCode(302);
    resp.SetHeader("Location","/");
}

int main(int argc, char *argv[])
{
    auto httpserver = std::make_unique<HttpServer>(8080);
    httpserver->Resgiter("/login",login);
    httpserver->Start();
    return 0;
}